<?php namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Catalog extends Model
{

    protected $fillable = ['name', 'p_id', 'level'];

    public function p_catalog()
    {
        return $this->belongsTo('App\Models\Catalog', 'p_id', 'id');
    }

    public function catalogs()
    {
        return $this->hasMany('App\Models\Catalog', 'id', 'p_id');
    }
}
